package hotelAction;

import hotel.Hotel;
import hotelDao.HotelDao;

import com.opensymphony.xwork2.ActionSupport;

public class HotelAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private Long id;

	private Hotel hotel;

	private HotelDao hotelDao;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Hotel getHotel() {
		return hotel;
	}

	public void setHotel(Hotel hotel) {
		this.hotel = hotel;
	}

	public HotelDao getHotelDao() {
		return hotelDao;
	}

	public void setHotelDao(HotelDao hotelDao) {
		this.hotelDao = hotelDao;
	}

	public String create() {
		return SUCCESS;
	}

	public String delete() {
		return SUCCESS;
	}

	public String updateFeature() {
		Hotel temp = hotelDao.selectAll();
		hotel.setId(temp.getId());
		hotel.setFront(temp.getFront());
		hotel.setSurvey(temp.getSurvey());
		hotelDao.update(hotel);
		return SUCCESS;
	}

	public String updateFront() {
		Hotel temp = hotelDao.selectAll();
		hotel.setId(temp.getId());
		hotel.setFeature(temp.getFeature());
		hotel.setSurvey(temp.getSurvey());
		hotelDao.update(hotel);
		return SUCCESS;
	}

	public String updateSurvey() {
		Hotel temp = hotelDao.selectAll();
		hotel.setId(temp.getId());
		hotel.setFeature(temp.getFeature());
		hotel.setFront(temp.getFront());
		hotelDao.update(hotel);
		return SUCCESS;
	}

	public String select() {
		hotel = hotelDao.selectAll();
		return SUCCESS;
	}
}
